
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>修改页</title>
</head>
<link rel="stylesheet" href="css/update.css">
<body>

<form action="book" method="post" enctype="multipart/form-data">
<%--    <input type="hidden" name="_method" value="put">--%>
    书id：<input type="text" name="bookId" value="${param.bookId}" readonly><br>
    书名： <input type="text" name="bookName" value="${param.bookName}"><br>
    书类型：<input type="text" name="bookType" value="${param.bookType}"><br>
    作者： <input type="text" name="writerName" value="${param.writerName}"><br>
    价格： <input type="text" name="bookPrice" value="${param.bookPrice}"><br>
    封面： <input type="file" name="UpdateAvater" id="imageInput"> <img src="${param.bookCover}" alt="" class="bookCover" id="bookCover">
    <br>
    出版时间： <input type="date" name="pubDate" value="${param.pubDate}"><br>
    <input type="submit" value="提交修改">
</form>
</body>
<script>
    document.getElementById('imageInput').addEventListener('change', function(event) {
        let file = event.target.files[0];
        let reader = new FileReader();
        reader.onload = function(e) {
            document.getElementById('bookCover').src = e.target.result;
        };
        reader.readAsDataURL(file);
    });
</script>

</html>
